#!/bin/bash

file="deployLogs/deploy.`date +"%d-%m-%y.%H:%M"`.log" 
touch "$file"
echo "Starting Deploy" > "$file"
echo "Starting Backup" >> "$file"
cd public_html
for i in `ls`
do
	if [[ "$i" != "qa" ]]
	then
		cp -R  $i ../backup/
	fi
done
echo "Copying $i" >> "../$file"
echo "Backup Finished at `date +"%D %H:%M"`" >> "../$file"
echo "Starting Deploy at `date +"%D %H:%M"`" >> "../$file"
cd qa
for i in `ls`
do
	if [[ "$i" == "properties" ]]
	then
		cd $i
		for j in `ls`
		do
			if [[ "$j" != "creds.xml" ]]
			then
				cp $j ../../properties/
			fi
		done
		cd ..
		
	else
		cp -R  $i ../
	fi
done
echo "Deploy Finished at `date +"%D %H:%M"`" >> "../../$file"
